<head>
<title>{{.Title}}</title>

<meta charset="utf-8">
<meta name="X-UA-Compatible" content="IE=edge">
<meta name="google-site-verification" content="{{ .Site.Params.googleSiteVerification }}">
<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
<meta content="telephone=no" name="format-detection">
<meta name="description" content="{{ .Params.description }}">
<meta name="renderer" content="webkit">
<meta name="theme-color" content="#ffffff">
<!-- metadata -->

{{ if .Site.GoogleAnalytics }}
{{ template "_internal/google_analytics.html" . }}
{{ end }}

<script src="{{"/vendor/js/jquery.min.js" | relLangURL}}" ></script>
<script src="{{"/vendor/js/popper.min.js" | relLangURL}}" ></script>
<script src="{{"/vendor/js/bootstrap.min.js" | relLangURL}}" ></script>
<script src="{{"/vendor/js/smooth-scroll.polyfills.min.js" | relLangURL}}" ></script>
<link type="text/css" rel="stylesheet" href="{{"/vendor/css/bootstrap.min.css" | relLangURL}}">
<script src="{{"/vendor/js/vue.min.js" | relLangURL}}" ></script>

{{ if .Site.Params.favicon }}
<link rel="icon" href="{{ .Site.Params.favicon }}">
<!-- favicon -->
{{ end }}

{{ $styles := resources.Get "scss/journal.scss" | toCSS | minify | fingerprint }}
<link rel="stylesheet" href="{{ $styles.Permalink }}" integrity="{{ $styles.Data.Integrity }}" media="screen">

<script src="{{.Site.BaseURL}}/js/loadCSS.js"></script>
<script src="{{.Site.BaseURL}}/js/table.js"></script>

{{ if and (not (.Params.disableToC) ) (.IsPage) }}
<script src="{{.Site.BaseURL}}/js/toc.js"></script>
{{ else }}
<style>
  .toc{
    display: none !important;
  }
</style>
{{ end }}

<script>
    loadCSS("https://fonts.loli.net/css?family=Lora|Montserrat|Fira+Mono|Noto+Serif+SC|Material+Icons");
</script>
{{ if and (.Site.Params.enableGitalk) (.IsPage) }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.css">
<script src="https://cdn.jsdelivr.net/npm/gitalk@1/dist/gitalk.min.js"></script>
<script src="{{"/vendor/js/md5.min.js" | relLangURL}}"></script>
<script>
  var gitalk = new Gitalk({
  clientID: '{{ .Site.Params.Gitalk.client_id }}',
  clientSecret: '{{ .Site.Params.Gitalk.client_secret }}',
  repo: '{{ .Site.Params.Gitalk.repo }}',
  owner: '{{ .Site.Params.Gitalk.owner }}',
  admin: ['{{ .Site.Params.Gitalk.owner }}'],
  id: md5(location.pathname),
  distractionFreeMode: 'false'
  });
  window.onload = function () {
        gitalk.render('gitalk-container')
  }
</script>
{{ end }}

{{ if and (.Site.Params.livereId) (.IsPage) }}
<script type="text/javascript">
$(
  (function(d, s) {
      var j, e = d.getElementsByTagName(s)[0];

      if (typeof LivereTower === 'function') { return; }

      j = d.createElement(s);
      j.src = 'https://cdn-city.livere.com/js/embed.dist.js';
      j.async = true;

      e.parentNode.insertBefore(j, e);
  })(document, 'script'));
</script>
{{ end }}

{{ if and (.Site.Params.enableValine) (.IsPage) }}
<script src='//unpkg.com/valine/dist/Valine.min.js'></script>
<script>
  $(new Valine({
      {{ if .Site.Params.Valine.avator }}
      avator: '{{.Site.Params.Valine.avator}}',
      {{ end }}
      el: '#vcomments',
      appId: '{{ .Site.Params.Valine.appId }}',
      appKey: '{{ .Site.Params.Valine.appKey }}',
      visitor: true,
      recordIP: true,
      verify: true
  }));
</script>
{{ end }}

</head>